package com.yuhs.zixing.study.design.pattern.dp001.principle.p03.dependency.inversion;

/**
 * @description 依赖倒置原则
 * 请完成person接受消息的功能
 * @author: yuhs
 * @date 2022/3/24 下午4:43
 */
public class DependencyInversionDemo001 {
    public static void main(String[] args) {
        Person001 person = new Person001();
        person.receive(new Email001());
    }
}

class Email001 {
    public String getInfo() {
        return "001电子邮件信息：hello,world";
    }
}

/**
 * 完成Person接收消息
 */
class Person001 {
    public void receive(Email001 email) {
        System.out.println("接收到邮件：" + email.getInfo());
    }

}
